package com.astronomia.wheels.page_utils;


import org.springframework.stereotype.Component;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @Package com.arrail.common.utils
 * @ClassName PageUtils
 * @Author li.chen
 * @Date 2019/4/12 15:45
 * @Version 1.0
 * @Description: 简单分页工具类
 */
@Component
public class PageUtils<T> {

    /**
     * @author zhijun.zhao
     * @date 2019/4/12 15:45
     * @param sour, pageSize, pageNum
     * @return int
     * @Description:  集合分页
     */
    public List<T>  page(List<T>  sour, int pageSize, int pageNum) {
        return  sour.stream().skip(pageSize * (pageNum - 1)).limit(pageSize).collect(Collectors.toList());
    }

}
